package dao.base;

import constants.DbConstants;
import dao.hikari.HikariDataSourceInstance;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public abstract class BaseDao<T> implements Dao<T> {

    /**
     * 从HikariCP中获取数据库连接
     * @return
     */
    final protected static Connection getHikariConn() {
        try {
            Connection conn = HikariDataSourceInstance.getHikariDataSource().getConnection();
            return conn;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

}
